package com.rxmvp.notifycationdemo;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;

public class MyReceiver extends BroadcastReceiver {
    public MyReceiver() {
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        // TODO: This method is called when the BroadcastReceiver is receiving
        // an Intent broadcast.
        //接收交互数据
        String extra = intent.getStringExtra("notification");
        //通过不同的action，执行不同的操作
        if ("com.huang.notification.receiver.delete1".equals(intent.getAction())) {
            extra = "收到了delete1 ： " + extra;
        } else if ("com.huang.notification.receiver.delete2".equals(intent.getAction())){
            extra = "收到了delete2 ： " + extra;
        }
        Toast.makeText(context, "receiver : 通知被销毁了，并打开服务, 接收到的action：" + extra, Toast.LENGTH_SHORT).show();
    }
}
